<!--
 * @description: 
 * @Author: Islands
 * @Date: 2024-06-23 00:34:12
 * @LastEditTime: 2024-06-23 02:54:23
-->
<script lang="ts" setup>
import { props } from '../props';
const { constants } = defineProps(props);
</script>
<template>
    <template v-for="item in constants">
        <el-table-column v-if="item.mode === 'index'" :type="item.type" width="55" :fixed="item.fixed" align="center"/>
        <el-table-column v-if="item.mode === 'column'" :prop="item.prop" :label="item.label" :width="item.width" :fixed="item.fixed" align="center"/>
        <el-table-column v-if="item.mode === 'state'" :prop="item.prop" :label="item.label" :width="item.width" align="center">
            <template #default="scope">
                <el-tag :type="scope.row[item.prop] ? 'success' : 'info'">{{ scope.row[item.prop] ? '启用' : '禁用' }}</el-tag>
            </template>
        </el-table-column>
        <el-table-column v-if="item.mode === 'icon'" :prop="item.prop" :label="item.label" :width="item.width" align="center">
            <template #default="{ row }">
                <i  :class="`iconfont icon-` + row[item.prop]" style="font-size: 22px" />
            </template>
        </el-table-column>
        <el-table-column v-if="item.mode === 'is'" :prop="item.prop" :label="item.label" :width="item.width" align="center">
            <template #default="{ row }">
                <el-tag v-if="item.tag" :type="row[item.prop] ? 'success' : 'info'">{{ row[item.prop] ? '是' : '否' }}</el-tag>
                <template v-else>
                    {{ row[item.prop] ? '是' : '否' }}
                </template>
            </template>
        </el-table-column>
        <el-table-column v-if="item.mode === 'tag'" :prop="item.prop" :label="item.label" :width="item.width" :fixed="item.fixed" align="center">
            <template #default="{ row }">
                <template v-for="ops in item.options">
                    <el-tag :type="ops.type" v-if="item.tag">
                        {{ row[item.prop] == ops.value ? ops.label : '----' }}
                    </el-tag>
                    <template v-else>
                        {{ row[item.prop] == ops.value ? ops.label : '----' }}
                    </template>
                </template>
            </template>
        </el-table-column>
        <el-table-column v-if="item.mode == 'other'" :prop="item.prop" :label="item.label" :width="item.width" :fixed="item.fixed" align="center">
            <template #default="scope">
                <slot :scope="scope" />
            </template>
        </el-table-column>
    </template>
</template>
